var page = require('webpage').create(), 
tabUrl = "https://detail.tmall.com/item.htm?id=545061345197&ali_trackid=17_dac701db6218e1377b2d09486ba66d62&spm=a21bo.50862.201862-3.1.47An6l";
//tabUrl = "https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=0&rsv_idx=1&tn=monline_5_dg&wd=pcsoft&rsv_pq=cb9161d400011ac8&rsv_t=f0e5Faht59BGlb6P25xgJ5C8viQ9HLofgSZbCTmR35RPw%2BVCvfP%2BcVNmXYde7cP6vnK7&rqlang=cn&rsv_enter=1&rsv_sug3=16&rsv_sug1=16&rsv_sug7=100&rsv_sug2=0&inputT=14559&rsv_sug4=16854";
         
//page.settings.userAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36";
page.settings.javascriptEnabled = true;
page.scrollPosition = {
		  bottom: 1000,
		  left: 0
		};
page.open(tabUrl, function(status) {
	if(status !== "success") {
		console.log("fail to load");
		phantom.exit();
	}else {
//		page.includeJs("http://www.pcsoft.com.cn/statics/js/jquery-1.8.3.min.js", function() {
//			var d = page.evaluate(function() {
////				window.setTimeout(function() {
//					$('window').scrollTop(2000);
//					return $('body').height();
////				},1500)
//			})
//			console.log("titleshi"+d);
//			setTimeout(function(){
//				page.render('taobao.png');
//			},2000)	
//			phantom.exit();
//		})
		
		
		page.render('taobao.png');
		phantom.exit();
		
	}
})

//page.onConsoleMessage = function(msg) {
//console.log(msg);
//};


